package r;

import aa.TopicTreeAddRequest;
import aa.TopicTreeGetRequest;
import aa.TopicTreeRemoveReplicateRequest;
import aa.TopicTreeRemoveRequest;
import aa.TopicTreeReplicateAddRequest;
import aa.TopicTreeReplicateSegmentRequest;
import ab.ClusterResponseCode;
import ab.ClusterResult;
import ac.ClientDataSerializer;
import ac.ClientSessionSerializer;
import ac.ClientSessionSubscriptionsSerializer;
import ac.ClusterDiscoveryTypeSerializer;
import ac.ClusterPublishRequestSerializer;
import ac.ClusterResponseCodeSerializer;
import ac.ClusterResultSerializer;
import ac.ClusterStateSerializer;
import ac.ClusterTransportTypeSerializer;
import ac.ImmutableListSerializer;
import ac.ImmutableMapSerializer;
import ac.ImmutablePairSerializer;
import ac.ImmutableSetSerializer;
import ac.InternalPublishSerializer;
import ac.KryoIds;
import ac.NodeInformationRequestSerializer;
import ac.NotificationRequestSerializer;
import ac.PubAckSerializer;
import ac.PubCompSerializer;
import ac.PubRecSerializer;
import ac.PubRelSerializer;
import ac.PublishSerializer;
import ac.QoSSerializer;
import ac.RetainedMessageSerializer;
import ac.SubscriberWithQoSSerializer;
import ac.TopicSerializer;
import ac.TopicSubscribersSerializer;
import ac.VectorClockSerializer;
import ae.CounterSerializer;
import ae.GaugeSerializer;
import ae.HistogramSerializer;
import ae.MeterSerializer;
import ae.TimerSerializer;
import af.ClientConnectedRequestSerializer;
import af.ClientDataRequestSerializer;
import af.ClientDisconnectedRequestSerializer;
import af.ClientSessionGetRequestSerializer;
import af.ClientSessionPutAllRequestSerializer;
import af.ClientSessionQueueEntrySerializer;
import af.ClientSessionReplicateRequestSerializer;
import af.ClientSessionSubscriptionAddReplicateRequestSerializer;
import af.ClientSessionSubscriptionAddRequestSerializer;
import af.ClientSessionSubscriptionAllReplicateRequestSerializer;
import af.ClientSessionSubscriptionGetRequestSerializer;
import af.ClientSessionSubscriptionRemoveAllReplicateRequestSerializer;
import af.ClientSessionSubscriptionRemoveReplicateRequestSerializer;
import af.ClientSessionSubscriptionRemoveRequestSerializer;
import af.ClientSessionSubscriptionReplicateRequestSerializer;
import af.ClientTakeoverRequestSerializer;
import af.ClusterContextRequestSerializer;
import af.ClusterPubRelRequestSerializer;
import af.LicenseCheckRequestSerializer;
import af.LicenseInformationResultSerializer;
import af.MessageFlowSerializer;
import af.MessageQueueDrainedAckRequestSerializer;
import af.MessageQueueOfferReplicateRequestSerializer;
import af.MessageQueuePollRequestSerializer;
import af.MessageQueueRemoveAllReplicateRequestSerializer;
import af.MessageQueueRemoveReplicateRequestSerializer;
import af.MessageQueueReplicateRequestSerializer;
import af.MessageQueueReplicationSerializer;
import af.MetricRequestSerializer;
import af.NodeForPublishRequestSerializer;
import af.OutgoingMessageFlowPutReplicateRequestSerializer;
import af.OutgoingMessageFlowPutRequestSerializer;
import af.OutgoingMessageFlowRemoveAllReplicateRequestSerializer;
import af.OutgoingMessageFlowReplicateRequestSerializer;
import af.RetainedMessageAddReplicateRequestSerializer;
import af.RetainedMessageAddRequestSerializer;
import af.RetainedMessageGetRequestSerializer;
import af.RetainedMessagePutAllRequestSerializer;
import af.RetainedMessageRemoveReplicateRequestSerializer;
import af.RetainedMessageRemoveRequestSerializer;
import af.StateRequestSerializer;
import ag.SegmentSerializer;
import ag.TopicTreeAddRequestSerializer;
import ag.TopicTreeGetRequestSerializer;
import ag.TopicTreeRemoveReplicateRequestSerializer;
import ag.TopicTreeRemoveRequestSerializer;
import ag.TopicTreeReplicateAddRequestSerializer;
import ag.TopicTreeReplicateSegmentRequestSerializer;
import ah.ClusterState;
import ai.TopicSubscribers;
import ak.VectorClock;
import bc1.ClientSessionQueueEntry;
import bg1.RetainedMessageEntity;
import bo.ClusterPublish;
import bu.InternalPublish;
import bx.SubscriberWithQoS;
import by.Segment;
import bz.RetainedMessage;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Timer;
import com.esotericsoftware.kryo.Kryo;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.hivemq.spi.message.MessageWithId;
import com.hivemq.spi.message.PubAck;
import com.hivemq.spi.message.PubComp;
import com.hivemq.spi.message.PubRec;
import com.hivemq.spi.message.PubRel;
import com.hivemq.spi.message.Publish;
import com.hivemq.spi.message.QoS;
import com.hivemq.spi.message.Topic;
import com.hivemq.spi.security.ClientData;
import d.CacheScoped;
import k.ClusterDiscovery;
import k.ClusterTransport;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.jgroups.Address;
import t1.AllClientsRequest;
import t1.ClientConnectedRequest;
import t1.ClientDataRequest;
import t1.ClientDisconnectedRequest;
import t1.ClientSessionGetRequest;
import t1.ClientSessionPutAllRequest;
import t1.ClientSessionReplicateRequest;
import t1.ClientTakeoverRequest;
import t1.ConnectedClientsRequest;
import t1.DisconnectedClientsRequest;
import t1.NodeForPublishRequest;
import u1.MessageFlow;
import u1.OutgoingMessageFlowPutReplicateRequest;
import u1.OutgoingMessageFlowPutRequest;
import u1.OutgoingMessageFlowRemoveAllReplicateRequest;
import u1.OutgoingMessageFlowReplicateRequest;
import v.ClientSession;
import v1.MessageQueueDrainedAckRequest;
import v1.MessageQueueOfferReplicateRequest;
import v1.MessageQueuePollRequest;
import v1.MessageQueueRemoveAllReplicateRequest;
import v1.MessageQueueRemoveReplicateRequest;
import v1.MessageQueueReplicateRequest;
import v1.MessageQueueReplication;
import w1.ClusterPubRelRequest;
import w1.ClusterPublishRequest;
import x1.RetainedMessageAddReplicateRequest;
import x1.RetainedMessageAddRequest;
import x1.RetainedMessageGetRequest;
import x1.RetainedMessagePutAllRequest;
import x1.RetainedMessageRemoveReplicateRequest;
import x1.RetainedMessageRemoveRequest;
import y.ClientSubscriptions;
import y1.ClusterContextRequest;
import y1.ClusterStateNotificationRequest;
import y1.ClusterStateRequest;
import y1.LicenseCheckRequest;
import y1.LicenseInformationRequest;
import y1.LicenseInformationResult;
import y1.MetricRequest;
import y1.NodeInformationRequest;
import y1.ReplicateFinishedRequest;
import z1.ClientSessionSubscriptionAddReplicateRequest;
import z1.ClientSessionSubscriptionAddRequest;
import z1.ClientSessionSubscriptionAllReplicateRequest;
import z1.ClientSessionSubscriptionGetRequest;
import z1.ClientSessionSubscriptionRemoveAllReplicateRequest;
import z1.ClientSessionSubscriptionRemoveReplicateRequest;
import z1.ClientSessionSubscriptionRemoveRequest;
import z1.ClientSessionSubscriptionReplicateRequest;

import javax.inject.Provider;
import java.util.HashMap;
import java.util.HashSet;

@CacheScoped
public class KryoProvider implements Provider<Kryo> {
    Kryo create() {
        return new Kryo();
    }

    @Override
    public Kryo get() {
        Kryo kryo = create();
        kryo.setReferences(false);
        kryo.register(Class.class, KryoIds.CLASS);
        kryo.register(Void.class, KryoIds.VOID);
        kryo.register(HashMap.class, KryoIds.HASH_MAP);
        kryo.register(HashSet.class, KryoIds.HASH_SET);
        kryo.register(Address.class, KryoIds.ADDRESS);
        kryo.register(MessageWithId.class, KryoIds.MESSAGE_WITH_ID);
        kryo.register(ReplicateFinishedRequest.class, KryoIds.REPLICATION_FINISHED_REQUEST);
        kryo.register(RetainedMessage.class, new RetainedMessageSerializer(), KryoIds.RETAINED_MESSAGE);
        kryo.register(ImmutablePair.class, new ImmutablePairSerializer(), KryoIds.IMMUTABLE_PAIR);
        kryo.register(QoS.class, new QoSSerializer(), KryoIds.QOS);
        kryo.register(Publish.class, new PublishSerializer(), KryoIds.PUBLISH);
        kryo.register(InternalPublish.class, new InternalPublishSerializer(), KryoIds.INTERNAL_PUBLISH);
        kryo.register(ClusterPublish.class, new InternalPublishSerializer(), KryoIds.CLUSTER_PUBLISH);
        kryo.register(PubAck.class, new PubAckSerializer(), KryoIds.PUB_ACK);
        kryo.register(PubRec.class, new PubRecSerializer(), KryoIds.PUB_REC);
        kryo.register(PubRel.class, new PubRelSerializer(), KryoIds.PUB_REL);
        kryo.register(PubComp.class, new PubCompSerializer(), KryoIds.PUB_COMP);
        kryo.register(Topic.class, new TopicSerializer(), KryoIds.TOPIC);
        kryo.register(VectorClock.class, new VectorClockSerializer(), KryoIds.VECTOR_CLOCK);
        kryo.register(RetainedMessageGetRequest.class, new RetainedMessageGetRequestSerializer(), KryoIds.RETAINED_MESSAGE_GET_REQUEST);
        kryo.register(RetainedMessageAddRequest.class, new RetainedMessageAddRequestSerializer(), KryoIds.RETAINED_MESSAGE_ADD_REQUEST);
        kryo.register(RetainedMessageRemoveRequest.class, new RetainedMessageRemoveRequestSerializer(), KryoIds.RETAINED_MESSAGE_REMOVE_REQUEST);
        kryo.register(RetainedMessageAddReplicateRequest.class, new RetainedMessageAddReplicateRequestSerializer(), KryoIds.RETAINED_MESSAGE_REPLICATION_ADD_REQUEST);
        kryo.register(RetainedMessageRemoveReplicateRequest.class, new RetainedMessageRemoveReplicateRequestSerializer(), KryoIds.RETAINED_MESSAGE_REPLICATION_REMOVE_REQUEST);
        kryo.register(RetainedMessageEntity.class, new RetainedMessageSerializer(), KryoIds.RETAINED_MESSAGE_ENTITY);
        kryo.register(ClusterStateRequest.class, new StateRequestSerializer(), KryoIds.STATE_REQUEST);
        kryo.register(ClusterStateNotificationRequest.class, new NotificationRequestSerializer(), KryoIds.NOTIFICATION_REQUEST);
        kryo.register(RetainedMessagePutAllRequest.class, new RetainedMessagePutAllRequestSerializer(), KryoIds.RETAINED_MESSAGE_PUT_ALL_REQUEST);
        kryo.register(ClusterState.class, new ClusterStateSerializer(), KryoIds.CLUSTER_STATE);
        kryo.register(ClusterResponseCode.class, new ClusterResponseCodeSerializer(), KryoIds.CLUSTER_RESPONSE_CODE);
        kryo.register(ClusterResult.class, new ClusterResultSerializer(), KryoIds.CLUSTER_RESULT);
        kryo.register(ClientSession.class, new ClientSessionSerializer(), KryoIds.CLIENT_SESSION);
        kryo.register(ClientSessionGetRequest.class, new ClientSessionGetRequestSerializer(), KryoIds.CLIENT_SESSION_GET_REQUEST);
        kryo.register(ClientConnectedRequest.class, new ClientConnectedRequestSerializer(), KryoIds.CLIENT_CONNECTED_REQUEST);
        kryo.register(ClientDisconnectedRequest.class, new ClientDisconnectedRequestSerializer(), KryoIds.CLIENT_DISCONNECTED_REQUEST);
        kryo.register(ClientSessionReplicateRequest.class, new ClientSessionReplicateRequestSerializer(), KryoIds.CLIENT_SESSION_REPLICATION_REQUEST);
        kryo.register(ClientSessionPutAllRequest.class, new ClientSessionPutAllRequestSerializer(), KryoIds.CLIENT_SESSION_PUT_ALL_REQUEST);
        kryo.register(ClientSessionSubscriptionGetRequest.class, new ClientSessionSubscriptionGetRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_GET_REQUEST);
        kryo.register(ClientSubscriptions.class, new ClientSessionSubscriptionsSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTIONS);
        kryo.register(ClientSessionSubscriptionAddRequest.class, new ClientSessionSubscriptionAddRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_ADD_REQUEST);
        kryo.register(ClientSessionSubscriptionRemoveRequest.class, new ClientSessionSubscriptionRemoveRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_REMOVE_REQUEST);
        kryo.register(ClientSessionSubscriptionAddReplicateRequest.class, new ClientSessionSubscriptionAddReplicateRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_REPLICATION_ADD_REQUEST);
        kryo.register(ClientSessionSubscriptionRemoveReplicateRequest.class, new ClientSessionSubscriptionRemoveReplicateRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_REPLICATION_REMOVE_REQUEST);
        kryo.register(ClientSessionSubscriptionRemoveAllReplicateRequest.class, new ClientSessionSubscriptionRemoveAllReplicateRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_REPLICATION_REMOVE_ALL_REQUEST);
        kryo.register(ClientSessionSubscriptionReplicateRequest.class, new ClientSessionSubscriptionReplicateRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_REPLICATION_REQUEST);
        kryo.register(ClientSessionSubscriptionAllReplicateRequest.class, new ClientSessionSubscriptionAllReplicateRequestSerializer(), KryoIds.CLIENT_SESSION_SUBSCRIPTION_REPLICATION_ALL_REQUEST);
        kryo.register(TopicTreeAddRequest.class, new TopicTreeAddRequestSerializer(), KryoIds.TOPIC_TREE_ADD_REQUEST);
        kryo.register(TopicTreeReplicateAddRequest.class, new TopicTreeReplicateAddRequestSerializer(), KryoIds.TOPIC_TREE_REPLICATION_ADD_REQUEST);
        kryo.register(TopicTreeRemoveRequest.class, new TopicTreeRemoveRequestSerializer(), KryoIds.TOPIC_TREE_REMOVE_REQUEST);
        kryo.register(TopicTreeRemoveReplicateRequest.class, new TopicTreeRemoveReplicateRequestSerializer(), KryoIds.TOPIC_TREE_REPLICATION_REMOVE_REQUEST);
        kryo.register(SubscriberWithQoS.class, new SubscriberWithQoSSerializer(), KryoIds.SUBSCRIBER_WITH_QOS);
        kryo.register(TopicSubscribers.class, new TopicSubscribersSerializer(), KryoIds.TOPIC_SUBSCRIBERS);
        kryo.register(TopicTreeGetRequest.class, new TopicTreeGetRequestSerializer(), KryoIds.TOPIC_TREE_GET_REQUEST);
        kryo.register(TopicTreeReplicateSegmentRequest.class, new TopicTreeReplicateSegmentRequestSerializer(), KryoIds.TOPIC_TREE_REPLICATION_SEGMENTS_REQUEST);
        kryo.register(Segment.class, new SegmentSerializer(), KryoIds.SEGMENT);
        kryo.register(ClusterPublishRequest.class, new ClusterPublishRequestSerializer(), KryoIds.CLUSTER_PUBLISH_REQUEST);
        kryo.register(ClientTakeoverRequest.class, new ClientTakeoverRequestSerializer(), KryoIds.CLIENT_TAKEOVER_REQUEST);
        kryo.register(NodeInformationRequest.class, new NodeInformationRequestSerializer(), KryoIds.CLUSTER_VERSION_REQUEST);
        kryo.register(ImmutableSet.class, new ImmutableSetSerializer(), KryoIds.IMMUTABLE_SET);
        kryo.register(ImmutableMap.class, new ImmutableMapSerializer(), KryoIds.IMMUTABLE_MAP);
        kryo.register(ImmutableList.class, new ImmutableListSerializer(), KryoIds.IMMUTABLE_LIST);
        kryo.register(ClusterDiscovery.Type.class, new ClusterDiscoveryTypeSerializer(), KryoIds.CLUSTER_DISCOVERY_TYPE);
        kryo.register(ClusterTransport.Type.class, new ClusterTransportTypeSerializer(), KryoIds.CLUSTER_TRANSPORT_TYPE);
        kryo.register(NodeForPublishRequest.class, new NodeForPublishRequestSerializer(), KryoIds.NODE_FOR_PUBLISH_REQUEST);
        kryo.register(MessageQueueOfferReplicateRequest.class, new MessageQueueOfferReplicateRequestSerializer(), KryoIds.MESSAGE_QUEUE_OFFER_REPLICATION_REQUEST);
        kryo.register(MessageQueuePollRequest.class, new MessageQueuePollRequestSerializer(), KryoIds.MESSAGE_QUEUE_POLL_REQUEST);
        kryo.register(MessageQueueRemoveReplicateRequest.class, new MessageQueueRemoveReplicateRequestSerializer(), KryoIds.MESSAGE_QUEUE_REMOVE_REPLICATION_REQUEST);
        kryo.register(MessageQueueRemoveAllReplicateRequest.class, new MessageQueueRemoveAllReplicateRequestSerializer(), KryoIds.MESSAGE_QUEUE_REMOVE_ALL_REPLICATION_REQUEST);
        kryo.register(MessageQueueDrainedAckRequest.class, new MessageQueueDrainedAckRequestSerializer(), KryoIds.MESSAGE_QUEUE_DRAINED_ACK_REQUEST);
        kryo.register(MessageQueueReplicateRequest.class, new MessageQueueReplicateRequestSerializer(), KryoIds.MESSAGE_QUEUE_REPLICATION_REQUEST);
        kryo.register(MessageQueueReplication.class, new MessageQueueReplicationSerializer(), KryoIds.MESSAGE_QUEUE_REPLICATION);
        kryo.register(ClientSessionQueueEntry.class, new ClientSessionQueueEntrySerializer(), KryoIds.CLIENT_SESSION_QUEUE_ENTRY);
        kryo.register(OutgoingMessageFlowPutRequest.class, new OutgoingMessageFlowPutRequestSerializer(), KryoIds.OUTGOING_MESSAGE_FLOW_PUT_REQUEST);
        kryo.register(OutgoingMessageFlowPutReplicateRequest.class, new OutgoingMessageFlowPutReplicateRequestSerializer(), KryoIds.OUTGOING_MESSAGE_FLOW_PUT_REPLICATION_REQUEST);
        kryo.register(OutgoingMessageFlowReplicateRequest.class, new OutgoingMessageFlowReplicateRequestSerializer(), KryoIds.OUTGOING_MESSAGE_FLOW_REPLICATION_REQUEST);
        kryo.register(OutgoingMessageFlowRemoveAllReplicateRequest.class, new OutgoingMessageFlowRemoveAllReplicateRequestSerializer(), KryoIds.OUTGOING_MESSAGE_FLOW_REMOVE_ALL_REPLICATION_REQUEST);
        kryo.register(MessageFlow.class, new MessageFlowSerializer(), KryoIds.MESSAGE_FLOW);
        kryo.register(ClusterContextRequest.class, new ClusterContextRequestSerializer(), KryoIds.CLUSTER_CONTEXT_REQUEST);
        kryo.register(MetricRequest.class, new MetricRequestSerializer(), KryoIds.METRIC_REQUEST);
        kryo.register(Gauge.class, new GaugeSerializer(), KryoIds.GAUGE);
        kryo.register(Counter.class, new CounterSerializer(), KryoIds.COUNTER);
        kryo.register(Meter.class, new MeterSerializer(), KryoIds.METER);
        kryo.register(Timer.class, new TimerSerializer(), KryoIds.TIMER);
        kryo.register(Histogram.class, new HistogramSerializer(), KryoIds.HISTOGRAM);
        kryo.register(ConnectedClientsRequest.class, KryoIds.CONNECTED_CLIENTS_REQUEST);
        kryo.register(DisconnectedClientsRequest.class, KryoIds.DISCONNECTED_CLIENTS_REQUEST);
        kryo.register(ClientDataRequest.class, new ClientDataRequestSerializer(), KryoIds.CONNECTED_CLIENT_REQUEST);
        kryo.register(ClientData.class, new ClientDataSerializer(), KryoIds.CLIENT_DATA);
        kryo.register(AllClientsRequest.class, KryoIds.ALL_CLIENTS_REQUEST);
        kryo.register(LicenseCheckRequest.class, new LicenseCheckRequestSerializer(), KryoIds.LICENSE_CHECK_REQUEST);
        kryo.register(LicenseInformationResult.class, new LicenseInformationResultSerializer(), KryoIds.LICENSE_INFORMATION_RESULT);
        kryo.register(LicenseInformationRequest.class, KryoIds.LICENSE_INFORMATION_REQUEST);
        kryo.register(ClusterPubRelRequest.class, new ClusterPubRelRequestSerializer(), KryoIds.CLUSTER_PUB_REL_REQUEST);
        kryo.addDefaultSerializer(PubAck.class, PubAckSerializer.class);
        kryo.addDefaultSerializer(PubRec.class, PubRecSerializer.class);
        kryo.addDefaultSerializer(PubRel.class, PubRelSerializer.class);
        kryo.addDefaultSerializer(PubComp.class, PubCompSerializer.class);
        kryo.addDefaultSerializer(ImmutableSet.class, ImmutableSetSerializer.class);
        kryo.addDefaultSerializer(ImmutableMap.class, ImmutableMapSerializer.class);
        kryo.addDefaultSerializer(ImmutableList.class, ImmutableListSerializer.class);
        kryo.addDefaultSerializer(Gauge.class, GaugeSerializer.class);
        kryo.addDefaultSerializer(Counter.class, CounterSerializer.class);
        kryo.addDefaultSerializer(Meter.class, MeterSerializer.class);
        kryo.addDefaultSerializer(Timer.class, TimerSerializer.class);
        kryo.addDefaultSerializer(Histogram.class, HistogramSerializer.class);
        kryo.addDefaultSerializer(ClientData.class, ClientDataSerializer.class);
        return kryo;
    }
}
